package cn.schoolwow.util.module.query.jsonarray.handler;

import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;
import cn.schoolwow.quickflow.listener.SingleFlowListener;
import com.alibaba.fastjson.JSONArray;

public class FilterJSONArraySingleFlowListener implements SingleFlowListener {
    @Override
    public void beforeExecuteFlow(BusinessFlow flow, FlowContext flowContext) throws Exception {
        JSONArray filterArray = (JSONArray) flowContext.getData("filterArray");
        if(null==filterArray||filterArray.isEmpty()){
            flowContext.brokenCurrentFlow("过滤列表已经为空");
        }
    }

    @Override
    public void afterExecuteFlow(BusinessFlow flow, FlowContext flowContext) throws Exception {

    }

    @Override
    public String name() {
        return "判断过滤后的JSONArray是否已经为空";
    }
}
